package com.halflife.framework.designPattens.prototype;

import com.halflife.comeElectricity.user.User;

/**
 * Created by zhaoyf on 2018/6/10.
 */
public class CloneTest implements Cloneable {
    private String name;
    private User user;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static void main(String[] args)throws  Exception {
        CloneTest test1 = new CloneTest();
        User user = new User();
        user.setId(11);
        test1.user = user;
        test1.name = "121";
        System.out.println(test1);
        CloneTest test2 = (CloneTest)test1.clone();
        System.out.println(test2.getName());
        System.out.println(test1.user);
        System.out.println(test2.user);
    }
}
